//
//  SHDiscountTableViewCell.m
//  UI_CarHome
//
//  Created by dllo on 15/10/31.
//  Copyright (c) 2015年 沈浩. All rights reserved.
//

#import "SHDiscountTableViewCell.h"
#import "SHHandle.h"
#import "SHObtainViewController.h"
#define TEXTCOL [SHSingleton shareSingletion].isNight ? [UIColor grayColor] : [UIColor blackColor]
@implementation SHDiscountTableViewCell
- (void)dealloc
{
    [_specnameLabel release];
    [_specpicImageView release];
    [_dealerpriceLabel release];
    [_fctpriceLabel release];
    [_tipLabel release];
    [_addressLabel release];
    [_shortnameLabel release];
    [_phoneButton release];
    [_lowPriceButton release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.specpicImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.specpicImageView];
    [_specpicImageView release];
    
    self.specnameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.specnameLabel];
    [_specnameLabel release];
    self.specnameLabel.numberOfLines = 2;
    self.specnameLabel.textColor = TEXTCOLOR;
    
    self.dealerpriceLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.dealerpriceLabel];
    [_dealerpriceLabel release];
    self.dealerpriceLabel.textAlignment = NSTextAlignmentCenter;
    self.dealerpriceLabel.textColor = [UIColor redColor];

    
    self.fctpriceLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.fctpriceLabel];
    [_fctpriceLabel release];
    self.fctpriceLabel.font = [UIFont systemFontOfSize:14];
    self.fctpriceLabel.textColor = [UIColor grayColor];
    
    
    self.tipLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.tipLabel];
    [_tipLabel release];
    self.tipLabel.textColor = [UIColor greenColor];
    self.tipLabel.textAlignment = NSTextAlignmentRight;
    self.tipLabel.textColor = [UIColor orangeColor];
    
    self.addressLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.addressLabel];
    [_addressLabel release];
    self.addressLabel.font = [UIFont systemFontOfSize:12];
    self.addressLabel.textColor = [UIColor grayColor];
    
    self.shortnameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.shortnameLabel];
    [_shortnameLabel release];
    self.shortnameLabel.font = [UIFont systemFontOfSize:12];
    self.shortnameLabel.textColor = [UIColor grayColor];
   
    
    self.phoneButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.contentView addSubview:self.phoneButton];
    [_phoneButton release];
    [self.phoneButton setTitle:@"立即拨打" forState:UIControlStateNormal];
    
    self.lowPriceButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.contentView addSubview:self.lowPriceButton];
    [_lowPriceButton release];
    [self.lowPriceButton setTitle:@"询最低价" forState:UIControlStateNormal];
  }



- (void)layoutSubviews {
    [super layoutSubviews];
    self.specpicImageView.frame = CGRectMake(5 * WID, 5 * HEI, 110 * WID, 80 * HEI);
    self.specnameLabel.frame = CGRectMake(120 * WID, 5 * HEI, 255 * WID, 50 * HEI);
    self.dealerpriceLabel.frame = CGRectMake(120 * WID, 65 * HEI, 70 * WID, 20 * HEI);
    self.fctpriceLabel.frame = CGRectMake(190 * WID, 65 * HEI, 70 * WID, 20 * HEI);
    self.tipLabel.frame = CGRectMake(270 * WID, 65 * HEI, 100 * WID, 20 * HEI);
    self.addressLabel.frame = CGRectMake(5 * WID, 90 * HEI, 60 * WID, 20 * HEI);
    self.shortnameLabel.frame = CGRectMake(70 * WID, 90 * HEI, 150 * WID, 20* HEI);
    
    
    self.phoneButton.frame = CGRectMake(20 * WID, 115 * HEI, 150 * WID, 30 * HEI);
    self.lowPriceButton.frame = CGRectMake(175 * WID, 115 * HEI, 150 * WID, 30 * HEI);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
